﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Util;
using System.Globalization;
using eMMBox.DA;
using System.Web.Security;

namespace eMMBox
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Util.Culture.GetCurrentCulture().Name == "pt-BR")
            {
                ConfigureToPortuguesePT();
            }
        }

        protected void ConfigureToPortuguesePT()
        {
            lblLogin.Text = "Login no eMMBox";
            lblAccount.Text = "Usuário";
            lblPassword.Text = "Senha";
            lbnForgotPassword.Text = "Esqueceu a senha?";
            lblError.Text = "Usuário ou senha inválidos.";
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (Login_DA.UserExists(tbxAccount.Text, tbxPassword.Text))
            {
                FormsAuthentication.RedirectFromLoginPage(tbxAccount.Text, false);
            }
            else
            {
                lblError.Visible = true;
            }
        }
    }
}
